package net.xdclass.demoproject.Callback;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("call")
public class shopping {// implements  ShoppingCallback{
    @Autowired
    private Store store;
    @GetMapping("back")
    public  void buy( String goodsName    ){
        System.out.println("start buy-----");
        Runnable runnable=()->{
            try {
                store.order(goodsName,this);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        };
        Thread thread=new Thread(runnable);
        thread.start();
        System.out.println("下单完成");
    };


//    @Override
    public void success(String name, String Price) {
        System.out.println(name);
    }
}
